#include "mainwindow.h"

#include <QApplication>
#include <QFile>
#include <QDebug>
#include <QDir>
#include <QSettings>
#include "resetdialog.h"
#include "chatdialog.h"

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    QFile qss(":/style/stylesheet.qss");
    if(qss.open(QFile::ReadOnly)){
        qDebug()<<"open success";
        QString style = QLatin1String(qss.readAll());
        a.setStyleSheet(style);
        qss.close();
    }else{
        qDebug()<<"open failed";
    }

    QString fileName = "config.ini";
    QString path = QDir::currentPath();//获取当前目录，因为config.ini就在当前工作目录下
    QString config_path = QDir::toNativeSeparators(path + QDir::separator() + fileName);
    QSettings settings(config_path,QSettings::IniFormat);//以ini的形式读取
    QString gate_host = settings.value("GateServer/host").toString();
    QString gate_port = settings.value("GateServer/port").toString();
    gate_url_prefix = "http://"+gate_host+":"+gate_port;
    qDebug()<<gate_host<<' '<<gate_port;
    qDebug()<<gate_url_prefix;

    MainWindow w;
    w.show();
    return a.exec();
}
